<?php
/**
 * Basic index with routing for the parser
 * 
 * Possible request parameters:
 *  - output: json|php|dump
 *  - filter: all|scripts|classes|functions
 */


require('DocsParser.inc.php');

$dir = '../builds/';
$cache = './cache/';

$build = 'trunk';

if (isset($_REQUEST['build']) && preg_match('/[a-z-]+/', $_REQUEST['build']) && is_dir($dir . $_REQUEST['build']) )
{
	$build = $_REQUEST['build'];
}

$parser = new DocsParser($dir . $build . '/', $dir . $cache . '/');

$parser->parseFromJson();

$output = 'json';
if (isset($_REQUEST['output']) )
{
	$output = $_REQUEST['output'];
}

$filter = 'all';
if (isset($_REQUEST['filter']) )
{
	$filter = $_REQUEST['filter'];
}

$parser->output($output, $filter);

?>